<!-- 继承自_layouts/template.html -->

{{ extend './_layouts/template.html'}}

{{block 'title'}}
学生管理页面
{{/block}}

{{block 'style'}}
<link rel="stylesheet" href="/public/css/main.css">
{{/block}}

{{block 'body'}}
<div class="container">
  <div class="header">
    <h1>Hello Nodejs</h1>
    <h2>学生列表</h2>
  </div>
  <br>
  <hr>
  <div class="main">
    <div class="table-list">
      <a href="students/new" class="btn btn-success">添加学生</a>
    </div>
    <table class="table table-striped table-hover table-sm">
      <thead>
        <tr>
          <th scope="col">#</th>
          <th scope="col">姓名</th>
          <th scope="col">性别</th>
          <th scope="col">年龄</th>
          <th scope="col">爱好</th>
          <th scope="col">操作</th>
        </tr>
      </thead>
      <tbody>
        {{ each students}}
        <tr>
          <th scope="row">{{ $index + 1 }}</th>
          <td>{{ $value.username }}</td>
          <td>{{ $value.gender==1 ? "男" : "女" }}</td>
          <td>{{ $value.age }}</td>
          <td>{{ $value.hobbies }}</td>
          <td>
            <a href="/students/edit?id={{$value._id}}">编辑</a>
            &nbsp;&nbsp;
            <a href="/students/delete?id={{$value._id}}">删除</a>
          </td>
        </tr>
        {{ /each }}
      </tbody>
    </table>
  </div>
</div>
{{/block}}

{{block 'script'}}

{{/block}}